package com.ynwt.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ynwt.enums.UserEventType;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by huangying on 2017/4/26.
 */
@Entity
@Table(indexes = {
        @Index(name = "pk_id", columnList = "id", unique = true),
        @Index(name = "idx_user", columnList = "c_user"),
        @Index(name = "idx_event", columnList = "c_event"),
        @Index(name = "idx_date", columnList = "date")})
public class UserEvent {

    @Id
    @GeneratedValue
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "c_user")
    private User user;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "c_event")
    private Event event;

    @Column
    @Temporal(TemporalType.TIMESTAMP)
    private Date date = new Date();

    @Column
    private long ycoin = 0;

    @Column
    private String content;

//    @Column
//    @Enumerated
//    private UserEventType type;

    public UserEvent() {
    }

    public UserEvent(User user, Event event) {
        this.user = user;
        this.event = event;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public long getYcoin() {
        return ycoin;
    }

    public void setYcoin(long ycoin) {
        this.ycoin = ycoin;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

//    public UserEventType getType() {
//        return type;
//    }
//
//    public void setType(UserEventType type) {
//        this.type = type;
//    }
}
